package com.xianyun.site.support.executor.commond;

import com.alibaba.cola.dto.Response;
import com.alibaba.fastjson.JSONObject;
import com.xianyun.site.support.api.MessageService;
import com.xianyun.site.support.common.MessageServiceFactory;
import com.xianyun.site.support.common.define.SupportTypeEnum;
import com.xianyun.site.support.dto.ReceiveCmd;
import org.springframework.stereotype.Component;

/**
 * 处理 与之前的对应业务处理逻辑的整合 根据处理完的操作码去动态决定调用情况
 * @author mac_zyj
 */
@Component
public class SupportMessageExo {

    public Response execute(ReceiveCmd receiveCmd, JSONObject receiveObject){
        SupportTypeEnum typeEnum = SupportTypeEnum.getTypeEnum(receiveCmd.getCheckParam().getOperationType());
        MessageService executor = MessageServiceFactory.getMessageService(typeEnum);
        return executor.analyseJsonAndSend(receiveCmd,receiveObject);
    }
}
